package com.xiangxiao.rpan.file.controller;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ZipUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;

import java.io.File;
import java.util.Date;

/**
 * @auther xiangxiao
 * @email 573768011@qq.com
 * @data 2023/11/29 16:05
 */
@Slf4j
@RestController
@RequestMapping("/api/file")
public class DownLoadController {
  private static Logger logger = LoggerFactory.getLogger(DownLoadController.class);

  @Value("${rpan.file.log.path}")
  private String zfileLogPath;

  @GetMapping("/log/download")
  public ResponseEntity<Resource> downLoadFile () {
    File fileZip = ZipUtil.zip(zfileLogPath);
    String currentDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
    return null;
  }
}
